package leetcode.editor.cn;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: Hugh
 * @Date: 2021/3/30
 */
public class Test {
    public String minWindow (String S, String T) {
        // write code here
        int left = 0, right = 0;
        String res = S;
        List<Character> window = new ArrayList<>();
        Map<Character, Integer> tmp = new HashMap<>();
        while(right < S.length()) {
            window.add(S.charAt(right));
            right++;
            // 如果符合要求，移动left缩小窗口
            while (isContainConditon(window, T)) {
                // 如果这个窗口的子串更短，则更新res
                res = minLen(res, window);
                window.remove(S.charAt(left));
                left++;
            }
        }
        return res;
    }

    private String minLen(String res, List<Character> window) {
        return null;
    }

    Boolean isContainConditon(List<Character> window, String target){
        return window.size() == target.length();
    }

}
